package com.yu.crm.feign.factory;

import com.yu.crm.domain.dto.WxCpDepartReq;
import com.yu.crm.domain.dto.WxCpUserReq;
import com.yu.crm.feign.remote.CrmUserFeignRemote;
import com.yxzz.common.exception.GeneralException;
import feign.hystrix.FallbackFactory;
import me.chanjar.weixin.cp.bean.WxCpDepart;

import java.util.HashMap;

/**
 * 企业微信熔断工厂抽象类
 */
public abstract class CrmUserFeignFallbackFactory implements FallbackFactory<CrmUserFeignRemote> {
    @Override
    public CrmUserFeignRemote create(Throwable throwable) {
        return new CrmUserFeignRemote() {

            @Override
            public void createUser(WxCpUserReq req) {
                throw new GeneralException("超时");
            }

            @Override
            public void updateUser(WxCpUserReq req) {
                throw new GeneralException("超时");
            }

            @Override
            public void deleteUser(HashMap<String,Object> map) {
                throw new GeneralException("超时");
            }

            @Override
            public HashMap<String,Object> createDept(WxCpDepartReq depart) {
                throw new GeneralException("超时");
            }

            @Override
            public void updateDept(WxCpDepartReq depart) {
                throw new GeneralException("超时");
            }

            @Override
            public void deleteDept(HashMap<String,Long> map) {
                throw new GeneralException("超时");
            }
        };
    }
}
